\title{TVCs and Computation Algorithm}
\author{Xinya Zhang}
\date{\today}

\documentclass[12pt]{article}
\renewcommand{\baselinestretch}{1.62}
\usepackage{graphicx}
\usepackage{rotating}
\usepackage{amsmath}
\usepackage[psamsfonts]{amssymb}
\usepackage{pifont}
\usepackage{enumerate}
\usepackage{theorem}
\begin{document}
\maketitle
\section{The Transversality Conditions}

In this problem, we have free terminal time and a scrap value function. Let's denote the optimal terminal time by $\hat{T}$ and the scrap value function by $\phi$. According to the textbook, the transversality condition is:

\begin{equation}
\mathcal{H}(\hat{T})+\frac{\partial\phi}{\partial\hat{T}}=0 \label{eq:TVC1}
\end{equation}

At $\hat{T}$, we can calculate $\lambda(\hat{T})$, $k(\hat{T})$ and $H(\hat{T})$ from equations below:

\begin{eqnarray}
\lambda(\hat{T}) &=& \bar{K}e^{-(\bar{A}-\beta)\hat{T}}  \label{eq:lambdaThat}\\
k(\hat{T}) &=& \frac{\gamma \bar{K}^{-1/\gamma}}{\bar{C}}e^{\frac{\bar{A}-\beta}{\gamma}\hat{T}} \label{eq:kThat} \\
H(\hat{T}) &=& \Gamma_2^{-1/\alpha}-\Gamma_1 \label{eq:hThat}
\end{eqnarray}
where 
\begin{eqnarray}
\bar{A} &=& A(1-\Gamma_2)-\delta, \; \bar{A}>0 \\
\bar{C} &=& \beta + \bar{A}\gamma-\bar{A}, \;\; \bar{C}>0
\end{eqnarray}

Note from above that $H(\hat{T})$ is independent of $\hat{T}$. Then we have
\begin{eqnarray}
\eta(\hat{T})\geq 0, \;\;H(\hat{T}) = b  \label{eq:TVC2}
\end{eqnarray} 
as another transversality condition, where $\eta$ is the costate variable of state variable $H$, and $b=\Gamma_2^{-1/\alpha}-\Gamma_1$.
 
\section{The Hamiltonian: $\mathcal{H}(\hat{T})$}
At $\hat{T}$, we have
\begin{eqnarray}
j&=&n=0 \\
R&=&0 \\
\zeta&=&0 \\
c&=&\lambda^{-1/\gamma} \\
q&=&\lambda \\
p&=&\Gamma_2 \\
i&=&(1-p)Ak-c \\
\end{eqnarray}

Sustitute the equations above into the Hamiltonian, we simplify it into
\begin{equation}
\mathcal{H}=\frac{\lambda^{1-\frac{1}{\gamma}}}{1-\gamma}+\lambda Ak(1-\Gamma_2) - \lambda^{1-1/\gamma} - \lambda\delta k + \eta\psi Ak  \label{eq:hamThat}
\end{equation}

\section{The Scrap Value Function: $\phi(\hat{T})$}

The scrap value function $\phi(\hat{T})$ represents the maximum value of an integral of future utility flow starting from time $\hat{T}$. Since we use the current value Hamiltonian, the scrap value function must be current value, too.
\begin{eqnarray}
\phi &=& \int_{\hat{T}}^{+\infty} \frac{\lambda^{1-1/\gamma}}{1-\gamma}\,\mathrm{d}\tau \label{eq:phiThat} 
\end{eqnarray}
Then we have
\begin{eqnarray}
\frac{\partial\phi}{\partial\hat{T}}=-\frac{\lambda^{1-\frac{1}{\gamma}}}{1-\gamma} \label{eq:phidt}
\end{eqnarray}

\section{ The Shadow price of $H$: $\eta(\hat{T})$ }

Substitute \eqref{eq:hamThat} and \eqref{eq:phidt} in to the transversality condition \eqref{eq:TVC1}:
\begin{eqnarray}
\lambda Ak(1-\Gamma_2) - \lambda^{1-1/\gamma} - \lambda\delta k + \eta\psi Ak =0 \label{eq:TVCfull}
\end{eqnarray}

By the equation \eqref{eq:TVCfull}, we could obtain the value of $\eta(\hat{T})$:
\begin{eqnarray}

\end{eqnarray}
  $\eta(\hat{T})$ also must satisfy \eqref{eq:TVC2}.

\section{Brief algorithm of backward computation}

I list all the intitial conditions below\footnote{From the algorithm below, I find that we only need two initial conditions $k(0)$ and $N(0)$. $c(0)$ should be an expression of $k(0)$, while $S(0)$ is an expression of $N(0)$.}:
\begin{eqnarray}
k(0) &=& k_0 \label{eq:ic1}\\
c(0)&=& c_0 \\
N(0) &=& 0 \label{eq:ic2}\\
S(0) &=& 0
\end{eqnarray}
\begin{enumerate}
\item Guess $\hat{T}$ and $\bar{K}$. At $\hat{T}$, calculate $\lambda(\hat{T})$, $k(\hat{T})$, $H(\hat{T})$ and $\eta(\hat{T})$ from the equations \eqref{eq:lambdaThat},\eqref{eq:kThat}, \eqref{eq:hThat} and \eqref{eq:TVCfull}. \item Solve the differential equations for $\lambda$, $k$, $H$ and $\eta$, and stop at $T_3$ when $\lambda=\eta$.
\item Find correct $\hat{T}$ when $j=0$ at $T_3$. 
\item At $T_3$, calculate $\lambda(T_3)$, $k(T_3)$, and $H(T_3)$ from previous regime.
\item Solve the differential equations for $\lambda$, $k$, $H$. Stop at $T_2$ when $H=0$. 
\item At $T_2$, calculate $\lambda(T_2)$ and $k(T_2)$ from previous regime. Guess $N(T_2)$. Obtain $S(T_2)$ from $g(S,N)$ and equation $\epsilon_{Fossil}(T_2)=\epsilon_{backstop}(T_2)$. $\sigma(T_2)=0$, $\nu(T_2)$=0.
\item Solve the differential equations for $\lambda$, $k$, $S$, $\sigma$, and $\nu$. Stop at $T_1$ when $\lambda=\nu$. 
\item At $T_1$, calculate $\lambda(T_1)$, $k(T_1)$, $S(T_1)$ and $\sigma(T_1)$ from previous regime. $N(T_1)=N(T_2)$
\item Solve the differential equations for $\lambda$, $k$, $S$, $\sigma$, and $N$ until $T=0$ .
\item Find correct $N(T_2)$ using initial condition \eqref{eq:ic2}. 
\item Find correct $\bar{K}$ using initial condition \eqref{eq:ic1}. 
\end{enumerate}






\end{document}
